<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    function formateUrl(url,data){
        var start =true;
        for(var key in data){
            if(strat){
                strat =false;
                url +="?"+key+"="+data[key];
            }else{
                url += "&"+key+"="+data[key];
            }
        }
    }
    return url
    // "type=0&pageNo=" + pageNo + "&pageSize=5&fromId="+ formId +"&jsonpcallback=callback&_=" + Date.now();
    var url = "https://api.gogoup.com/p1/data/recommend"
    var data ={
        //类型
        type :0,
        //页码
        pageNo:2,
        //传递数量
        pageSize:5,
        //图片起始点的ID
        fromId:375,
        //回调函数名称
        jsonpcallback:"callback",
        //时间戳
        _:Date.now()
    }
    var res = formateUrl(url,data)
    console.log(res)
</script>